package com.blog.feignclients;

import com.blog.entity.Users;
import com.blog.vos.CollectionVOS;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

//调用ORDERS服务的接口
//指明是 feign的客户端接口(要调用服务的服务名)
@FeignClient(value = "ORDERS" ,fallback = OrdersClientFallback.class)
public interface OrdersClient {

    @GetMapping("/orders")
    String demo1();

    @GetMapping("/orders/demo2/{uname}/{age}")
    String demo2(@PathVariable("uname") String uname, @PathVariable("age") Integer age);

    @PostMapping("/orders/demo3")
    String demo3(@RequestBody Users users);

    //接收数组
    @GetMapping("/orders/demo4")
     String demo4(@RequestParam("uNames") String[] uNames);


    //接收集合
     @GetMapping("/orders/demo5")
     String demo5(@RequestBody CollectionVOS collectionVOS);

    /**
     * 处理响应
     */
    //接收id,返回对象
    @GetMapping("/orders/demo6/{id}")
    Users demo6(@PathVariable("id") Integer id);

    //接收id,返回Map
    @GetMapping("/orders/demo7/{id}")
   String demo7(@PathVariable("id") Integer id);

    //接收id,返回Map
    @GetMapping("/orders/demo8")
    String demo8(@RequestParam("id") Integer id);
}

